<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<#include "/admin/include/head.htm">
<#include "/admin/include/upload.ftl">
<script type="text/javascript" src="${base}/resource/thirdparty/editor/kindeditor.js"></script>
<script type="text/javascript" src="${base}/resource/js/input.js"></script>
<script type="text/javascript">
	var goodsCategoryTree = null;
	var selectCategory = null;
	var leafOnly = true;
	//更改eidtor插件本地上传目录为文章目录
	setting.uploadType = "goods";	
	
	var brandGrid = null;
	var selectBrand = null;
    $(function () {
		var mainform = $("#mainform");  
		// Tab效果
		tabs = $("#tab").tabs("div.tabContent", {
			tabs: "input"
		});
		isTabValid();
		$("#tabcontainer input").attr("autocomplete", "off");
		
		$("#goodsCategoryName").focus(function() {
			if(goodsCategoryTree) {
				goodsCategoryTree.show();
			} else {
				goodsCategoryTree = $.ligerDialog.open({
					url: '${base}/admin/b2c/goods/goodsCategoryTree.jhtml',
					left: $(this).offset().left,
					top: $(this).offset().top,
					height: 400,
					width: null,
					modal: true,
					titie: '商品分类', 
					buttons: [{
						text: '确定',
						onclick: function(item, dialog) {
							if(selectCategory) {
								selectCategory();
							}
						}
					}, { 
						text: '取消', 
						onclick: function (item, dialog) {
							dialog.hide(); 
						} 
					}] 
				});
			}
		});
		
		$("#brandName").focus(function() {
			if(brandGrid) {
				brandGrid.show();
			} else {
				brandGrid = $.ligerDialog.open({
					url: '${base}/admin/b2c/goods/brandGrid.jhtml',
					height: 500,
					width: 800,
					modal: true,
					titie: '品牌', 
					buttons: [{
						text:'选择',
						onclick: function(item, dialog) {
							if(selectBrand) {
								selectBrand();
							}
						}
					}, { 
						text: '取消', 
						onclick: function (item, dialog) {
							dialog.hide(); 
						} 
					}] 
				});
			}
			
		});
    });
</script>
<style type="text/css">
	#tabcontainer .l-tab-links ul{margin-left:160px;}
	#tabcontainer{padding-top:20px;}
	.l-tab-links{background:none;}
	.l-tab-links li{margin: 0 0 0 12px;}
	.table th {
	    width: 110px;
	}
</style>
</head>
<#if !(goods.id)??>
	<#assign isAdd = true />
<#else>
	<#assign isEdit = true />
</#if>
<body>
<form action="<#if isAdd??>${base}/admin/b2c/goods/save.jhtml<#else>${base}/admin/b2c/goods/update.jhtml</#if>" method="post" id="validateForm">
<div id="tabcontainer" style="margin:10px;">
	<#if !isAdd??>
		<input type="hidden" name="id" value="${(goods.id)!''}" id="goods_id"/>
	</#if>
	<ul class="tab" id="tab">
		<li><input type="button" value="商品基础信息"></li>
		<li><input type="button" value="商品信息"></li>
		<li><input type="button" value="销售信息"></li>
		<#--<li><input type="button" value="证件信息"></li>-->
		<li><input type="button" value="控制信息"></li>
		<#--<li><input type="button" value="购买限制"></li>-->
		<li><input tyype="button" value="相册"></li>
		<#--<li><input type="button" value="药品说明书"></li>-->
		<li><input type="button" value="标签"></li>
	</ul>
	<#include "/admin/b2c/goods/input_basic.ftl"/>
	<#include "/admin/b2c/goods/input_message.ftl"/>
	<#include "/admin/b2c/goods/input_sale.ftl"/>
	<#--<#include "/admin/b2c/goods/input_licence.ftl"/>-->
	<#include "/admin/b2c/goods/input_control.ftl"/>
	<#--<#include "/admin/b2c/goods/input_limit.ftl">-->
	<#include "/admin/b2c/goods/input_album.ftl">
	<#--<#include "/admin/b2c/goods/input_introduction.ftl">-->
	<#include "/admin/b2c/goods/input_tag.ftl">
</div>
<#include "/admin/include/form-bar.ftl">
</form>
</body>
</html>